package com.test.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import pojo.User;

/**
 * @Author:huang
 * @Date: Created in 2021/5/14 17:19
 */
@Controller
@RequestMapping("/t1")
public class ParamController {

    @RequestMapping("/test")
    public String test(@RequestParam("username") String name, Model model){

        model.addAttribute("msg",name);
        return "redirect:/index.jsp";

    }

    @RequestMapping("/test2")
    public String test2(User user, Model model){
        System.out.println(user);

        model.addAttribute("msg",user.getName());
        return "hello";

    }
}
